<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
        $this->stylesBase = $this->view->baseUrl() . '/styles/';
    }
    
    /*
    public function preDispatch()
    {
        // Als de gebruiker geen identiteit heeft, ga naar loginController indexAction.
        if (!Zend_Auth::getInstance()->hasIdentity()) {
             $this->_helper->redirector('index', 'user'); // Zend_Controller_Action_Helper_Redirector
        }   
    }
*/
    public function indexAction()
    {
       
        $view = $this->_getView('Welcome');
        $auth = Zend_Auth::getInstance();
        if($auth->hasIdentity())
        {
            $storage = $auth->getStorage()->read();
            $view->user_givenname = $storage->user_givenname;
            $view->user_familyname = $storage->user_familyname;
            $view->user_role = $storage->user_role;
            
        }

        
    
    }
    private function _getView($title)
    {
    $view = $this->view;
        $view->title = $title;
        $view->headTitle($view->title);
        $view->headLink()
             ->appendStylesheet($this->stylesBase. 'main.css');

        return $view;
    }


}

